<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>
<?
  $rss = $db->query('SELECT * FROM hs_category ORDER BY c_name');
  $catlist = '';
  while ($line = $db->fetchNextObject($rss)){
    $catlist .= '<option value="'.$line->c_id.'">'.$line->c_name.'</option>';
  }
  
  $rss = $db->query('SELECT * FROM hs_collection ORDER BY pc_name');
  $collectionlist = '';
  while ($line = $db->fetchNextObject($rss)){
    $collectionlist .= '<option value="'.$line->pc_id.'">'.$line->pc_name.'</option>';
  }
?>
<div id = "body">

<h1><?_l('Add Product')?></h1>
<div class = "clear"></div>


<form method="post" action="product_add.php" class = "form" enctype="multipart/form-data">
  
  <?php
    if(isset($_GET['aid']) AND $_GET['aid']!=''):
    
    $collectionName = $db->queryUniqueValue('SELECT pc_name FROM hs_collection ORDER BY pc_name');
  ?>
  <div class = "field"><label><?_l('collection')?></label><input type = "text" name = "collection_name" class = "input size1" value="<?php echo $collectionName; ?>" readonly="readonly"></div>
  <input type = "hidden" name = "collection" class = "input size1" value="<?php echo $_GET['aid']; ?>">
  <?php else: ?>
  <div class = "field"><label><?_l('collection')?></label><select name="collection"><option value="0"></option><?php echo $collectionlist; ?></select></div>
  <?php endif ?>
  
  <div class = "field"><label><?_l('category')?></label><select name="cat"><?php echo $catlist; ?></select></div>
  <div class = "field display_none"><label><?_l('name')?></label><input type = "text" name = "name" class = "input size1"></div>
  <div class = "field"><label><?_l('style number')?></label><input type = "text" name = "style_number" class = "input size1"></div>
  <div class = "field"><label><?_l('product type')?></label><input type = "text" name = "product_type" class = "input size1"></div>
  <div class = "field"><label><?_l('metal')?></label><input type = "text" name = "metal" class = "input size1"></div>
  <div class = "field"><label><?_l('lenght')?>(inch)</label><input type = "text" name = "lenght_inch" class = "input size1"></div>
  <div class = "field"><label><?_l('lenght')?>(mm)</label><input type = "text" name = "lenght_mm" class = "input size1"></div>
  <div class = "field"><label><?_l('width')?>(mm)</label><input type = "text" name = "width_mm" class = "input size1"></div>
  
  <div class = "field"><label><?_l('image')?></label><input type = "file" name = "image" class = "input size1" > * ratio 1:1</div>
  <div class = "field"><label><?_l('detail')?></label><textarea name = "detail" class="mceNoEditor"></textarea></div>
  <div class = "field"><label><?_l('active')?></label><input type = "checkbox" name = "active" value = "1" checked="checked"></div>
  <div class = "field"><label><?_l('User Allow')?></label><input type = "checkbox" name = "user_allow[]" value = "1" checked="checked"> Non member <input type = "checkbox" name = "user_allow[]" value = "2" checked="checked"> General member </div>
  <hr>
  <div class = "field"><label></label><input type = "submit" value = "<?=__l('add')?>" class = "btn">&nbsp;<a href = "#" class = "btn" onclick="javascript:history.back(1)"><?_l('cancel')?></a></div>
</form>

</div>

<style>
  .form label {
    width:80px;
  }
  .form .mceNoEditor{
    width:350px;
    height:120px;
  }
</style>
</div>
<? include "../footer.php" ?>